class Light {
    #status: string
    #color: string

    public on() {
        if (this.#status === "on") {
            throw new Error("The light is on")
        }
        this.#status = "on"
    }

    public set color(color: string) {
        if (this.#status !== "on") {
            throw new Error("The light is not on")
        }
        this.#color = color
    }
}

function main() {
    const light = new Light()
    light.on()
    light.color = "red"
}




